package com.lqfan.autoAnswerQ.service.notebook.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lqfan.autoAnswerQ.controller.importQuestions.PoiWordController;
import com.lqfan.autoAnswerQ.dao.notebook.NoteBookMapper;
import com.lqfan.autoAnswerQ.model.notebook.myNote;
import com.lqfan.autoAnswerQ.model.subject.Subject;
import com.lqfan.autoAnswerQ.service.notebook.INoteBookService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NotebookServiceImpl extends ServiceImpl<NoteBookMapper, myNote> implements INoteBookService {
    private static final Logger logger = LoggerFactory.getLogger(PoiWordController.class);
    @Autowired
    private INoteBookService noteBookService;
    private NoteBookMapper noteBookMapper;
    @Override
    public boolean insertNoteBook(String userId,String subjectId,String noteContent) {
        myNote notebook = new myNote();
        notebook.setUserId(userId);
        notebook.setSubjectId(subjectId);
        notebook.setNoteContent(noteContent);
        boolean saveRes = save(notebook);
        return saveRes;
    }

    public List<Subject> getNoteSubject(String userId){
        List<Subject> res = baseMapper.getSubjectNote(userId);
        return res;
    }
//    @Override
//    public int deleteNote(String userId, String id) {
//        myNote myNote = new myNote();
//        myNote.setUserId(userId);
//        myNote.setId(id);
//        boolean result = baseMapper.deleteNote(myNote);
//        if (result){
//            return 1;
//        }
//        return 0;
//    }
}
